package com.rr.mymoney.jsf;

import java.io.Serializable;
import java.util.Date;

import javax.faces.bean.ManagedBean;

import org.springframework.context.annotation.Scope;

@ManagedBean
@Scope("request")
public class RegisterBean implements Serializable {
    private static final long serialVersionUID = 3806131628442809756L;

    private String email;
    private String userName;
    private String password;
    private String confirmPassword;
    private Date dob;

    /**
     * @return the email
     */
    public String getEmail() {
	return email;
    }

    /**
     * @param email
     *            the email to set
     */
    public void setEmail(String email) {
	this.email = email;
    }

    /**
     * @return the userName
     */
    public String getUserName() {
	return userName;
    }

    /**
     * @param userName
     *            the userName to set
     */
    public void setUserName(String userName) {
	this.userName = userName;
    }

    /**
     * @return the password
     */
    public String getPassword() {
	return password;
    }

    /**
     * @param password
     *            the password to set
     */
    public void setPassword(String password) {
	this.password = password;
    }

    /**
     * @return the confirmPassword
     */
    public String getConfirmPassword() {
	return confirmPassword;
    }

    /**
     * @param confirmPassword
     *            the confirmPassword to set
     */
    public void setConfirmPassword(String confirmPassword) {
	this.confirmPassword = confirmPassword;
    }

    /**
     * @return the dob
     */
    public Date getDob() {
	return dob;
    }

    /**
     * @param dob
     *            the dob to set
     */
    public void setDob(Date dob) {
	this.dob = dob;
    }

    public String register() {
	String message = userName + " is now registered";
	System.out.println(message);
	return message;
    }

    public String getRegisterMessage() {
	if (userName == null) {
	    return "You are not registered";
	} else {
	    return "You are registered as " + userName;
	}
    }

}
